<!DOCTYPE html>
<html
        xmlns:th="http://www.thymeleaf.org"
>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>注册</title>
    <style>
        body {
            background: url("/img/v2-4140af78cd90201a338a189ad7dbeda6_r.jpg") no-repeat;
            background-size: 100% 130%;
        }

        #login_box {
            width: 20%;
            height: 400px;
            background-color: #00000060;
            margin: auto;
            margin-top: 10%;
            text-align: center;
            border-radius: 10px;
            padding: 50px 50px;
        }

        h2 {
            color: #ffffff90;
            margin-top: 5%;
        }

        #input-box {
            margin-top: 5%;
        }

        span {
            color: #fff;
        }

        #username, #password, #repassword {
            border: 0;
            width: 60%;
            font-size: 15px;
            color: #fff;
            background: transparent;
            border-bottom: 2px solid #fff;
            padding: 5px 10px;
            outline: none;
            margin-top: 10px;
        }

        button {
            margin-top: 50px;
            width: 60%;
            height: 30px;
            border-radius: 10px;
            border: 0;
            color: #fff;
            text-align: center;
            line-height: 30px;
            font-size: 15px;
            background-image: linear-gradient(to right, #30cfd0, #330867);
        }

        #sign_up {
            margin-top: 45%;
            margin-left: 60%;
        }

        #re {
            background: transparent;

        }

        a {
            color: #b94648;
        }

    </style>
    <script src="/js/ajax.aspnetcdn.com_ajax_jquery_jquery-1.9.0.min.js"></script>

    <script src="http://libs.baidu.com/jquery/1.9.0/jquery.js"></script>
    <script src="https://cdn.staticfile.org/axios/0.18.0/axios.min.js"></script>
</head>

<body>
<div id="login_box">
    <form id="form1" th:action="@{/user/register}" method="post">
        <h2>REGISTE</h2>

        <div class="alert alert-success" role="alert" align="center">
            <span style="color: red" th:text="${msg}" th:if="${not #strings.isEmpty(msg)}"></span>
        </div>
        <div class="input_box">
            <input id="username" type="text" name="username" placeholder="请输入账号">
        </div>
        <div id="input_box">
            <input id="password" type="text" name="password" placeholder="请输入密码">
        </div>
        <div class="input_box">
            <input id="repassword" type="password" name="repassword" placeholder="请再次输入密码">
        </div>


        <button id="rebutton"type="submit" >注册</button>
    </form>

</div>
<!--<script>-->
<!--    $(document).ready(function (){-->
<!--        $("#rebutton").click(function (){-->

<!--            $.ajax({-->
<!--                url:"/user/register",-->
<!--                type:"POST",-->
<!--                data:$("#form1").serialize(),-->
<!--                dataType:"JSON",-->
<!--                success:function (json){-->
<!--                    if (json.state == 100){-->
<!--                        alert("成功")-->
<!--                        location.href="login.html"-->
<!--                    }else if (json.state==110)-->
<!--                    {-->
<!--                        alert("用户名必须大于两个字符")-->
<!--                    }else if (json.state==120){-->
<!--                        alert("用户名已存在")-->
<!--                    }-->

<!--                },-->
<!--                error:function (xhr){-->
<!--                    alert("发生错误"+xhr.status)-->
<!--                }-->
<!--            })-->
<!--        });-->
<!--    });-->


<!--</script>-->
</body>
</html>